home *** CD-ROM | disk | FTP | other *** search
/ Aminet 28 / Aminet 28 (1998)(GTI - Schatztruhe)[!][Dec 1998].iso / Aminet / dev / misc / gms_dev.lha / GMSDev / Source / C / Blitter / BlitArea.c next >
Encoding:
C/C++ Source or Header  |  1998-08-17  |  1.5 KB  |  62 lines

  1. /* Dice: 1> dcc -l0 -mD dpk.o tags.o BlitArea.c -o BlitArea
  2. **
  3. ** This demo tests the BlitArea() routine.
  4. */
  5.  
  6. #include <proto/dpkernel.h>
  7.  
  8. BYTE *ProgName      = "Area Blitter";
  9. BYTE *ProgAuthor    = "Paul Manias";
  10. BYTE *ProgDate      = "August 1998";
  11. BYTE *ProgCopyright = "DreamWorld Productions (c) 1996-1998.  Freely distributable.";
  12. BYTE *ProgShort     = "BlitArea() demonstration.";
  13.  
  14. struct GScreen  *screen;
  15. struct JoyData  *joydata;
  16. struct Picture  *background;
  17. struct FileName BackFile = { ID_FILENAME, "GMS:demos/data/PIC.Green" };
  18.  
  19. void Demo(void);
  20.  
  21. /***************************************************************************/
  22.  
  23. void main(void) {
  24.   if (background = Load(&BackFile, ID_PICTURE)) {
  25.    if (screen = Get(ID_SCREEN)) {
  26.       CopyStructure(background, screen);
  27.     if (Init(screen,NULL)) {
  28.      if (Copy(background->Bitmap,screen->Bitmap) IS ERR_OK) {
  29.       if (joydata = Get(ID_JOYDATA)) {
  30.          joydata->Port = 1;     /* Forces mouse control */
  31.  
  32.        if (Init(joydata, NULL)) {
  33.           Display(screen); 
  34.           Demo();
  35.        }
  36.       }
  37.      }
  38.     }
  39.    }
  40.   Free(joydata);
  41.   Free(screen);
  42.   Free(background);
  43.   }
  44. }
  45.  
  46. /***************************************************************************/
  47.  
  48. void Demo(void)
  49. {
  50.   do
  51.   {
  52.     WaitAVBL();
  53.     Query(joydata);
  54.  
  55.     BlitArea(screen->Bitmap, screen->Bitmap, FastRandom(screen->Width-16)+16,
  56.       FastRandom(screen->Height-16)+16, 16, 16, FastRandom(screen->Width)-8,
  57.       FastRandom(screen->Height)-8, FALSE);
  58.  
  59.   } while (!(joydata->Buttons & JD_RMB));
  60. }
  61.  
  62.